package com.xm.servlet.background.commodity;

import com.xm.service.background.CommodityService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * @author 康文程
 * @date 2024-1-17 上午 08:54
 */
@WebServlet("/background/update/commmodity/gitfts/id")
public class UpdateCommodityGitftsIdServlet extends HttpServlet {
    private final CommodityService service = new CommodityService();
    @SneakyThrows
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)  {
        String commodityId = req.getParameter("commodityId");
        String commodityGiftsId = req.getParameter("commodityGiftsId");
        resp.getWriter().print(service.updateCommodityGiftsById(Integer.parseInt(commodityId)
                ,commodityGiftsId == null ? null : Integer.parseInt(commodityGiftsId)));
    }
}
